<?
	$container=json_decode($model->container_param);
?>

<div class='contentheader'>Neues Pagetemplate</div>
<?
echo form::open();
echo form::hidden('id', $model->id);
echo form::open_fieldset();
echo myform::inputfield('title','Title',$model->title, 'class="text"');
echo myform::textarea('description','Beschreibung', $model->description );
echo myform::inputfield('html_url','Template View File',$model->html_url);
echo form::close_fieldset();
for($i=0;$i<5;$i++){

	$title='';
	if($container!=''){
		if( $i<count($container) ){
			$title=$container[$i]->title;
		}
	}
	
	echo form::open_fieldset();
	echo form::legend('Container '.$title);
	echo myform::inputfield('container_param_array['.$i.'][title]','Title',$title);
	
	
	
	if($title!=''){
	
	$mymodules=NULL;
	if(array_key_exists('mymodules', $container[$i])){
		$mymodules=$container[$i]->mymodules;
	}
	
	$contmods=ORM::factory('contentmodule')->find_all();
	
	foreach($contmods as $contmod){			
		
		$id=$contmod->id;
		$selected=0;
				
		if($mymodules!=NULL){
			if(isset($mymodules->$id)){
				$selected=$mymodules->$id;	
			}
		}
		
		
		//echo form::label('container_param_array['.$i.'][mymodules]['.$id.']', $contmod->title);
		//echo form::hidden('container_param_array['.$i.'][mymodules]['.$id.']', 0);
		echo myform::checkbox2('container_param_array['.$i.'][mymodules]['.$id.']', 1 ,$contmod->title,$selected);
		//echo '</p>';
	}
	}
	
	
	
	echo form::close_fieldset();
}

/*
echo '<p>';
echo form::label('css_url', 'Css Url');
echo form::input('css_url',$model->css_url, 'class="text"');
echo '</p>';

echo '<p>';
echo form::label('css', 'CSS');
echo form::textarea('css', $model->css, 'class="textbig"');
echo '</p>';

echo '<p>';
echo form::label('javascript_url', 'Javascript Url');
echo form::input('javascript_url',$model->javascript_url, 'class="text"');
echo '</p>';

echo '<p>';
echo form::label('javascript', 'Javascript');
echo form::textarea('javascript', $model->javascript, 'class="textbig"');
echo '</p>';
*/
/*
echo '<p>';
echo form::label('html', 'HTML');
echo form::textarea('html', $model->html, 'class="textbig"');
echo '</p>';
*/



echo form::close_fieldset();

echo myform::submit();

echo form::close();
?>